//
//  Copyright (C) 2009-2010 Vadim Ushakov
// 
//  This program is free software; you can redistribute it and/or modify it
//  under the terms of the GNU General Public License as published by the Free
//  Software Foundation; either version 2 of the License, or (at your option)
//  any later version.
// 
//  This program is distributed in the hope that it will be useful, but
//  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
//  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
//  for more details.
//  
//  You should have received a copy of the GNU General Public License along
//  with this program; if not, write to the Free Software Foundation, Inc.,
//  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//

#include "descriptor.h"
#include "interrupt.h"
#include "kernelError.h"
#include "core0/kernelPerformanceCounter.h"
#include "core0/kernelHEventTable.h"



void archInterruptDispatch(machHEventState* state);

void archInterruptDispatch(machHEventState* state)
{
	unsigned vector = state->vector;
	kernelCallHEventHandler(vector, state);
}

extern void archInterruptHandlers(void);
extern int archInterruptHandlerSize;

int archInterruptInitialize(void)
{
	int status = 0;
	int count;
  
	for (count = 0; count < 256; count ++)
	{
		kernelDescriptorSetIDTInterruptGate(count,
			((char*)archInterruptHandlers) + count * archInterruptHandlerSize);
	}

	return (status = 0);
}
